
#pragma once

#define SAFE_DELETE(p)			if (p) { delete(p); (p) = nullptr; }

#define SRAND_GLFW_TIME (srand((unsigned int)glfwGetTime()))
#define RANDOM_FLOAT(max, min) ((((float)rand())/double(RAND_MAX)) * (max - min) + min)
#define RANDOM_FLOAT_0(max) RANDOM_FLOAT(max, 0)
#define TYPEDEF_SHARED_PTR(className) typedef std::shared_ptr<className> className##Ptr

#define PROPERTY(varType, varName, funName)\
protected: varType varName;\
public: virtual varType get##funName(void) const { return varName; }\
public: virtual void set##funName(varType var){ varName = var; }

#define PROPERTY_BY_REF(varType, varName, funName)\
protected: varType varName;\
public: virtual const varType& get##funName(void) const { return varName; }\
public: virtual void set##funName(varType var){ varName = var; }

#define PROPERTY_READONLY(varType, varName, funName)\
protected: varType varName;\
public: virtual varType get##funName(void) const { return varName; }

#define PROPERTY_READONLY_BY_REF(varType, varName, funName)\
protected: varType varName;\
public: virtual const varType& get##funName(void) const { return varName; }
